<script>
	export default {
		onLaunch: function() {
			let systemInfo = uni.getSystemInfoSync()
			if(systemInfo.platform === 'android'){
				if(!uni.getStorageSync('userInfo')){
					this.Android()
				}
			}
		},
		onShow: function() {
			// 小程序更新检测
			// #ifdef MP-WEIXIN
			this.autoUpdate()
			// #endif
		},
		onHide: function() {
			
		},
		methods: {
			Android () {
				this.$api.HomeWeChat().then(res => {
					if(res.datas.is_show_store_app==2){
						uni.reLaunch({
							url: '/pages/login/login'
						})
					}
				})
			},
			autoUpdate () {
				var self = this
				if (uni.canIUse('getUpdateManager')) {
					const updateManager = uni.getUpdateManager()
					updateManager.onCheckForUpdate(function (res) {
						if (res.hasUpdate) {
							updateManager.onUpdateReady(function () {
								uni.showModal({
									title: '更新提示',
									content: '新版本已经准备好，是否重启应用？',
									success: function (update) {
										if (update.confirm) {
											updateManager.applyUpdate()
										} else if (update.cancel) {
											uni.showModal({
												title: '温馨提示~',
												content: '本次版本更新涉及到新的功能添加，旧版本无法正常访问的哦~',
												success: function (cancelUpdate) {
													self.autoUpdate()
													return;
													if (cancelUpdate.confirm) {
														updateManager.applyUpdate()
													} else if (cancelUpdate.cancel) {
														self.autoUpdate()
													}
												}
											})
										}
									}
								})
							})
							updateManager.onUpdateFailed(function () {
								uni.showModal({
									title: '已经有新版本了哟~',
									content: '新版本已经上线啦~，请您删除当前小程序，重新搜索打开哟~',
								})
							})
						}
					})
				} else {
					uni.showModal({
						title: '提示',
						content: '当前微信版本过低，请升级到最新微信版本！'
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	@import url("/static/scss/base.scss");
	uni-checkbox:not([disabled]) .uni-checkbox-input:hover{
		border-color: #999;
	}
	.batch-manage-list uni-checkbox-group,.case-batch-manage-list uni-checkbox-group{
		padding-bottom: 20rpx;
	}
	.batch-manage .uni-checkbox-input,.batch-manage .wx-checkbox-input,
	.case-batch-manage .uni-checkbox-input,.case-batch-manage .wx-checkbox-input,
	.selectProItem .uni-checkbox-input,.selectProItem .wx-checkbox-input,
	.staff .uni-checkbox-input,.staff .wx-checkbox-input,
	.purchase-info-4 .uni-checkbox-input,.purchase-info-4 .wx-checkbox-input,
	{
		border-radius: 50%;
		background-color: #EEE;
		border-color: #999;
	}
	.batch-manage .uni-checkbox-input-checked,.batch-manage .wx-checkbox-input-checked,
	.case-batch-manage .uni-checkbox-input-checked,.case-batch-manage .wx-checkbox-input-checked,
	.selectProItem .uni-checkbox-input-checked,.selectProItem .wx-checkbox-input-checked,
	.staff .uni-checkbox-input-checked,.staff .wx-checkbox-input-checked,
	.purchase-info-4 .uni-checkbox-input-checked,.purchase-info-4 .wx-checkbox-input-checked{
		background-color: #FE9B26;
		border-color: #FE9B26;
	}
	.batch-manage .uni-checkbox-input:hover,
	.case-batch-manage .uni-checkbox-input:hover,
	.selectProItem .uni-checkbox-input:hover,
	.staff .uni-checkbox-input:hover{
		border-color: #FE9B26 !important;
	}
	.selectProItem{
		.uni-transition{
			height: 100%;
			background-color: #FFF;
			.uni-popup__wrapper-box{
				height: 100%;
			}
		}
	}
	uni-radio[disabled]{
		filter: grayscale(1);
	}
	/* #ifdef MP-WEIXIN */
	button[type=primary]{
		background-color: #2073F5;
	}
	button[type=primary][plain]{
		color: #2073F5;
		border-color: #2073F5;
	}
	/* #endif */
	.selectProItem .uni-transition{
		max-height: 90%;
	}
</style>
